/*
package com.tianzmp.ttq.admin.security;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.auth0.jwt.exceptions.JWTDecodeException;
import com.auth0.jwt.exceptions.SignatureVerificationException;
import com.tianzmp.ttq.admin.common.Result;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;

*/
/**
 * @author zhumengping
 *//*

@Log4j2
public class JwtInterceptor implements HandlerInterceptor {


    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        String token = request.getHeader("Authorization");
        Map<String,String> responseMap = new HashMap<>(16);
        responseMap.put("code", "500");
        responseMap.put("data", "");
        if (StringUtils.isNotBlank(token)){
            try {
                JwtUtils.verify(token);
                return true;
            }catch (Exception e) {
                responseMap.put("msg", "token is error");
            }
            response.setContentType("application/json;charset=utf-8");
            response.getWriter().println(JSONObject.toJSON(responseMap));
            return false;
        }
        responseMap.put("msg","token is empty");
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().println(JSONObject.toJSON(responseMap));
        return false;

    }

    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
    }
}
*/
